package mv.wap;

/**
 * Class description...
 *
 * @author mvu
 */
public class Link extends Element{
  private String _targetID;
  private Page _target;

  public Link(Page target){
    _target = target;
    _targetID = target.getTitle();
  }

  public Link(String targetID){
    _targetID = targetID;
  }

  @Override
  String toHtml(Element parent) {
    return build(new BlockRunner(){
      public void append(StringBuffer br) {
        br.append("<a href=\"").append(_targetID).append(".html")
                .append("\">").append(_targetID)
                .append("</a>");
      }
    });
  }

  public Page getTarget() {
    return _target;
  }
}
